package com.lishuaihua.binding.demo.navigation

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.navigation.Navigation
import com.lishuaihua.binding.demo.R
import com.lishuaihua.binding.demo.databinding.FragmentNav1Binding
import com.lishuaihua.binding.viewbind


class FragmentNav1 : Fragment() {

    val binding: FragmentNav1Binding by viewbind()

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        return binding.root
    }


    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        binding.btnJump.setOnClickListener {
            Navigation.findNavController(it).navigate(R.id.action_fragmentNav1_to_fragmentNav2)
        }
    }
}